$OpenBSD: patch-lib_CMakeLists_txt,v 1.4 2017/04/15 20:49:44 sthen Exp $
--- lib/CMakeLists.txt.orig	Mon Feb 20 22:06:57 2017
+++ lib/CMakeLists.txt	Fri Apr 14 15:35:06 2017
@@ -48,12 +48,12 @@ add_library(libmosquitto SHARED
 
 set (LIBRARIES ${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES})
 
-if (UNIX AND NOT APPLE)
+if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
 	find_library(LIBRT rt)
 	if (LIBRT)
 		set (LIBRARIES ${LIBRARIES} rt)
 	endif (LIBRT)
-endif (UNIX AND NOT APPLE)
+endif (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
 
 if (WIN32)
 	set (LIBRARIES ${LIBRARIES} ws2_32)
@@ -70,6 +70,12 @@ if (${WITH_SRV} STREQUAL ON)
 	endif (ARES_HEADER)
 endif (${WITH_SRV} STREQUAL ON)
 
+include(CheckSymbolExists)
+CHECK_SYMBOL_EXISTS(arc4random_uniform stdlib.h ARC4RANDOM_UNIFORM)
+if (${ARC4RANDOM_UNIFORM})
+	add_definitions("-DWITH_ARC4RANDOM")
+endif (${ARC4RANDOM_UNIFORM})
+
 target_link_libraries(libmosquitto ${LIBRARIES})
 
 set_target_properties(libmosquitto PROPERTIES
@@ -81,6 +87,3 @@ set_target_properties(libmosquitto PROPERTIES
 install(TARGETS libmosquitto RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
 install(FILES mosquitto.h DESTINATION "${INCLUDEDIR}")
 
-if (UNIX)
-	install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
-endif (UNIX)
